]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
build: Do not redefine polkit autocleanup
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 17 May 2022 13:36:43 +0000 (15:36 +0200)
committerMarge Bot <marge-bot@gnome.org>
Tue, 17 May 2022 14:04:01 +0000 (14:04 +0000)
PolkitAgent recently added autocleanup functions itself, so check
for their existence at configure time and only define our own when
they don't exist upstream.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5490

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2296>

config.h.meson
meson.build
src/shell-polkit-authentication-agent.h

index b93fda87278b03d0fa58e8ca171c9324bc704994..ff355d306215be6d0e158e177bd184c03990a03f 100644 (file)
@@ -33,3 +33,6 @@
 
 /* Define if fdwalk is available in libc */
 #mesondefine HAVE_FDWALK
+
+/* Define if polkit defines autocleanup functions */
+#mesondefine HAVE_POLKIT_AUTOCLEANUP
index 42ec01c566873b90854b15111e8a16a055ad2e9e..778a34c6efe96bf8b9df7f25def6498f578a46ba 100644 (file)
@@ -169,6 +169,13 @@ cdata.set('HAVE_FDWALK',
           cc.has_function('fdwalk')
 )
 
+polkit_has_autocleanup = cc.compiles(
+  '#define POLKIT_AGENT_I_KNOW_API_IS_SUBJECT_TO_CHANGE
+  #include <polkitagent/polkitagent.h>
+  void main(void) { g_autoptr(PolkitAgentListener) agent = NULL; }',
+  dependencies: polkit_dep)
+cdata.set('HAVE_POLKIT_AUTOCLEANUP', polkit_has_autocleanup)
+
 buildtype = get_option('buildtype')
 if buildtype != 'plain'
   all_warnings = [
index 55b46af1106e151721454efda9e872eb48b68845..4f14749563d2db3925cd2be21d0cb0d54ce79e01 100644 (file)
 
 G_BEGIN_DECLS
 
+#ifndef HAVE_POLKIT_AUTOCLEANUP
 /* Polkit doesn't have g_autoptr support, thus we have to manually set the autoptr function here */
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (PolkitAgentListener, g_object_unref)
+#endif
 
 #define SHELL_TYPE_POLKIT_AUTHENTICATION_AGENT (shell_polkit_authentication_agent_get_type())